<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <button @contextmenu.prevent="">阻止右键</button>

    <!-- 组织事件传播 -->
    <div @click="fn1">outer1
      <div @click.stop="fn2">inner1</div>
    </div>

    <!-- 事件变成捕获 -->
    <div @click.capture="fn2">
      outer2 <div @click="fn1">inner2</div>
    </div>

    <!-- 只加载事件对象 -->
    <div @click.self="fn2">
      outer2
      <div @click="fn1">inner2</div>
    </div>

    <!-- 只执行一次 -->

    <div @click.once="fn2">
      outer2 <div @click.once="fn1">inner2</div>
    </div>

    <!-- 键盘事件 -->
    <input type="text" @keyup.13="fn1">
    <input type="text" @keyup.enter="fn1">
    <input type="text" @keyup.space="fn1">
    <input type="text" @keydown.tab="fn1">
    <input type="text" @keydown.esc="fn1">

  </div>

  <script>
    Vue.config.prodactionTip = false

    const vm = new Vue({
      el: "#app",
      data() {
        return {
          fn1() {
            console.log("fn1执行了");
          },
          fn2() {
            console.log("fn2执行了");
          }
        }
      }

    })
  </script>
</body>

</html>